﻿@model eShopLegacyMVC.Models.CatalogItem

@{
    ViewBag.Title = "Edit";
}

<h2 class="esh-body-title">Edit</h2>


@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()
    <div class="container">
        <div class="row">
            <img class="col-md-6 esh-picture" src="@Model.PictureUri" />
            <div class="col-md-6 form-horizontal">
                @Html.ValidationSummary(true, "", new { @class = "text-danger" })
                @Html.HiddenFor(model => model.Id)

                <div class="form-group">
                    @Html.LabelFor(model => model.Name, htmlAttributes: new { @class = "control-label col-md-4" })
                    <div class="col-md-8">
                        @Html.EditorFor(model => model.Name, new { htmlAttributes = new { @class = "form-control" } })
                        @Html.ValidationMessageFor(model => model.Name, "", new { @class = "text-danger" })
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.Description, htmlAttributes: new { @class = "control-label col-md-4" })
                    <div class="col-md-8">
                        @Html.EditorFor(model => model.Description, new { htmlAttributes = new { @class = "form-control" } })
                        @Html.ValidationMessageFor(model => model.Description, "", new { @class = "text-danger" })
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.CatalogBrandId, "CatalogBrandId", htmlAttributes: new { @class = "control-label col-md-4" })
                    <div class="col-md-8">
                        @Html.DropDownList("CatalogBrandId", null, htmlAttributes: new { @class = "form-control" })
                        @Html.ValidationMessageFor(model => model.CatalogBrandId, "", new { @class = "text-danger" })
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.CatalogTypeId, "CatalogTypeId", htmlAttributes: new { @class = "control-label col-md-4" })
                    <div class="col-md-8">
                        @Html.DropDownList("CatalogTypeId", null, htmlAttributes: new { @class = "form-control" })
                        @Html.ValidationMessageFor(model => model.CatalogTypeId, "", new { @class = "text-danger" })
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.Price, htmlAttributes: new { @class = "control-label col-md-4" })
                    <div class="col-md-8">
                        @Html.EditorFor(model => model.Price, new { htmlAttributes = new { @class = "form-control" } })
                        @Html.ValidationMessageFor(model => model.Price, "", new { @class = "text-danger" })
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.PictureFileName, htmlAttributes: new { @class = "control-label col-md-4" })
                    <div class="col-md-8">
                        @Html.EditorFor(model => model.PictureFileName, new { htmlAttributes = new { @class = "form-control", @readonly = "readonly", Title = "Not allowed for edition" } })
                        @Html.ValidationMessageFor(model => model.PictureFileName, "", new { @class = "text-danger" })
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.AvailableStock, htmlAttributes: new { @class = "control-label col-md-4" })
                    <div class="col-md-8">
                        @Html.EditorFor(model => model.AvailableStock, new { htmlAttributes = new { @class = "form-control" } })
                        @Html.ValidationMessageFor(model => model.AvailableStock, "", new { @class = "text-danger" })
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.RestockThreshold, htmlAttributes: new { @class = "control-label col-md-4" })
                    <div class="col-md-8">
                        @Html.EditorFor(model => model.RestockThreshold, new { htmlAttributes = new { @class = "form-control" } })
                        @Html.ValidationMessageFor(model => model.RestockThreshold, "", new { @class = "text-danger" })
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.MaxStockThreshold, htmlAttributes: new { @class = "control-label col-md-4" })
                    <div class="col-md-8">
                        @Html.EditorFor(model => model.MaxStockThreshold, new { htmlAttributes = new { @class = "form-control" } })
                        @Html.ValidationMessageFor(model => model.MaxStockThreshold, "", new { @class = "text-danger" })
                    </div>
                </div>

                <div class="form-group">
                    <div class="col-md-12 text-right esh-button-actions">
                        @Html.ActionLink("[ Cancel ]", "Index", null, new { @class = "btn esh-button esh-button-secondary" })
                        <button type="submit" class="btn esh-button esh-button-primary">[ Save ]</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
}

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
